﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>tinymce6-layer-示例</title>
    <link type="text/css" rel="Stylesheet" href="demo.css" />
    <script type="text/javascript" src="WordPaster/js/jquery-1.8.3.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="WordPaster/js/json2.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="WordPaster/js/layer-3.1.1/layer.js" charset="utf-8"></script>
    <script type="text/javascript" src="WordPaster/js/w.layer.js" charset="utf-8"></script>
	<script type="text/javascript" src="zyCapture/z.layer.js" charset="utf-8"></script>
	<script type="text/javascript" src="zyOffice/js/o.layer.js" charset="utf-8"></script>
    <script type="text/javascript" src="scripts/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
	<script type="text/javascript" src="demo.js" charset="utf-8"></script>
</head>
<body>
	<div style=" font-size:medium; line-height:130%;">
		<p>演示方法：</p>
		<ul style="list-style-type:decimal;">
			<li>打开Word文档，复制多张图片，然后在编辑器中按 Ctrl+V 粘贴，编辑器将自动上传所有图片。</li>
			<li>复制电脑中任意图片文件，然后点击编辑器中的图片粘贴按钮。</li>
			<li>通过QQ或其它软件截屏，复制图片，然后点击编辑器中的图片粘贴按钮。</li>
		</ul>
		<p>相关问题：</p>
		<ul style="list-style-type:decimal;">
			<li>安装插件<a target="_blank" href="http://www.ncmem.com/webapp/wordpaster/pack.aspx">下载插件</a></li>
		    <li>WindowxXP/Windows7/Windows2003如果无法识别数字证书，请先下安装<a target="_blank" href="http://www.ncmem.com/download/WoSignRootUpdate.rar">数字签名根证书</a></li>
		</ul>
		<div id="demos"></div>
		<textarea id="txt">
			<p>泽优全平台内容发布解决方案 for asp tinymce6</p>
            <p>泽优Word一键粘贴控件（WordPaster）</p>
            <p>泽优全平台截屏控件（zyCapture）</p>
            <p>泽优Office文档转换服务（zyOffice）</p>
		</textarea>
	</div>	
	<!--创建TinyCME控件-->
	<script language="javascript" type="text/javascript">
		var pos = window.location.href.lastIndexOf("/");
		var root = window.location.href.substr(0, pos + 1);
        var api = [
            window.location.href.substr(0, pos + 1),
            "asp/upload.asp"
        ].join("");
		WordPaster.getInstance({
			//上传接口：http://www.ncmem.com/doc/view.aspx?id=d88b60a2b0204af1ba62fa66288203ed
            PostUrl: api,
			//为图片地址增加域名：http://www.ncmem.com/doc/view.aspx?id=704cd302ebd346b486adf39cf4553936
            ImageUrl: "",
            //设置文件字段名称：http://www.ncmem.com/doc/view.aspx?id=c3ad06c2ae31454cb418ceb2b8da7c45
            FileFieldName: "img",
            //提取图片地址：http://www.ncmem.com/doc/view.aspx?id=07e3f323d22d4571ad213441ab8530d1
            ImageMatch: '',
			event:{
				dataReady:function(e){
					//e.word,
					//e.imgs:tag1,tag2,tag3
					console.log(e.imgs)
				}
			}
        });//加载控件
		
		//zyCapture
        zyCapture.getInstance({
            config: {
                PostUrl: api,
				FileFieldName: "img",
                Fields: { uname: "test" }
            }
        });

        //zyoffice，
        //使用前请在服务端部署zyoffice，
        //http://www.ncmem.com/doc/view.aspx?id=82170058de824b5c86e2e666e5be319c
        zyOffice.getInstance({
            word:"http://localhost:13710/zyoffice/word/convert",
            wordExport:"http://localhost:13710/zyoffice/word/export",
            pdf:"http://localhost:13710/zyoffice/pdf/upload"
        });
	
        tinymce.init({
            selector: '#txt',
            //汉化,路径是自定义的，一般放在public或static里面，汉化文件要自己去下载
            //language_url: '/tinymce/zh_CN.js',
            //language: 'zh_CN',
            //皮肤
            skin: 'oxide',
            //隐藏技术支持
            branding: false,
            //隐藏底栏的元素路径
            elementpath: false,
            //关闭菜单
            menubar: false,
            //隐藏状态栏
            statusbar: false,
            //工具栏
            toolbar: 'bold italic underline forecolor fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | tiny_mce_wiris_formulaEditor tiny_mce_wiris_formulaEditorChemistry | image | zycapture | wordpaster importwordtoimg netpaster wordimport excelimport pptimport pdfimport | importword exportword importpdf',            
            //粘贴data格式的图像
            paste_data_images: true,
			setup:function(edt){
                //To add a simple triangle icon:
				edt.ui.registry.addIcon('zycapture', '<img src="' + root + 'zyCapture/z.png"/>');
                edt.ui.registry.addIcon('wordpaster', '<img src="' + root + 'WordPaster/imgs/word.png"/>');
				edt.ui.registry.addIcon('importwordtoimg', '<img src="' + root + 'WordPaster/imgs/word1.png"/>');
                edt.ui.registry.addIcon('netpaster', '<img src="' + root + 'WordPaster/imgs/net.png"/>');
				edt.ui.registry.addIcon('wordimport', '<img src="' + root + 'WordPaster/imgs/word2.png"/>');
				edt.ui.registry.addIcon('excelimport', '<img src="' + root + 'WordPaster/imgs/xls.png"/>');
                edt.ui.registry.addIcon('pptimport', '<img src="' + root + 'WordPaster/imgs/ppt.png"/>');
                edt.ui.registry.addIcon('pdfimport', '<img src="' + root + 'WordPaster/imgs/pdf.png"/>');
				edt.ui.registry.addIcon('importword', '<img src="' + root + 'zyOffice/css/w.png"/>');
                edt.ui.registry.addIcon('exportword', '<img src="' + root + 'zyOffice/css/we.png"/>');
                edt.ui.registry.addIcon('importpdf', '<img src="' + root + 'zyOffice/css/pdf.png"/>');

                edt.ui.registry.addButton('zycapture', {
                    icon: 'zycapture',
                    tooltip:"截屏(zyCapture)",
                    onAction: () => {                        
                        zyCapture.setEditor(edt).Capture2();
                    }
                });
				edt.ui.registry.addButton('wordpaster', {
                    icon: 'wordpaster',
                    tooltip: "Word一键粘贴",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().PasteManual()
                    }
                });
				edt.ui.registry.addButton('importwordtoimg', {
                    icon: 'importwordtoimg',
                    tooltip: "Word转图片",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().importWordToImg()
                    }
                });
				edt.ui.registry.addButton('netpaster', {
                    icon: 'netpaster',
                    tooltip: "网络图片一键上传",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().PasteManual()
                    }
                });
				edt.ui.registry.addButton('wordimport', {
                    icon: 'wordimport',
                    tooltip: "导入Word文档",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().importWord()
                    }
                });
				edt.ui.registry.addButton('excelimport', {
                    icon: 'excelimport',
                    tooltip: "导入Excel文档",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().importExcel()
                    }
                });
                edt.ui.registry.addButton('pptimport', {
                    icon: 'pptimport',
                    tooltip: "导入PPT文档",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().importPPT()
                    }
                });
                edt.ui.registry.addButton('pdfimport', {
                    icon: 'pdfimport',
                    tooltip: "导入PDF文档",
                    onAction: () => {
                        WordPaster.getInstance().SetEditor(edt);
                        WordPaster.getInstance().ImportPDF()
                    }
                });
				edt.ui.registry.addButton('importword', {
                    icon: 'importword',
                    tooltip: "导入Word文档(docx)",
                    onAction: () => {                        
                        zyOffice.SetEditor(edt).api.openDoc()
                    }
                });
                edt.ui.registry.addButton('exportword', {
                    icon: 'exportword',
                    tooltip: "导出Word文档(docx)",
                    onAction: () => {                        
                        zyOffice.SetEditor(edt).api.exportWord()
                    }
                });
                edt.ui.registry.addButton('importpdf', {
                    icon: 'importpdf',
                    tooltip: "导入PDF文档",
                    onAction: () => {                        
                        zyOffice.SetEditor(edt).api.openPdf()
                    }
                });
				
                edt.on("paste",function(e){
                    WordPaster.getInstance().SetEditor(edt);
                    WordPaster.getInstance().PasteManual();
					e.preventDefault();
                });
            }
        });
	</script>
</body>
</html>